﻿using System.Web;
using OpenWaves.ActivityFeed.RavenDB;
using Raven.Client;

namespace ActivityFeed.Web.RavenDB
{
    public class DocumentSessionPerRequestProvider : IDocumentSessionProvider
    {
        public IDocumentSession DocumentSession
        {
            get { return CurrentDocumentSession; }
            set { CurrentDocumentSession = value; }
        }

        public static IDocumentSession CurrentDocumentSession
        {
            get { return HttpContext.Current.Items[typeof(IDocumentSession).FullName] as IDocumentSession; }
            set { HttpContext.Current.Items[typeof(IDocumentSession).FullName] = value; }
        }
    }
}
